<template>
	<view class="home_item" v-for="item in proList" @click="toDetail(item)">
		<view class="home_userImg">
			<image mode="widthFix" src="../../static/user.png" style="width: 99px;"></image>
		</view>
		<view class="home_content">
			<view class="content_title">
				<view>
					<view>{{item.title}}</view>
					<text>{{item.content}}</text>
				</view>
				<view>
					{{item.amount}}
				</view>
			</view>
			<view class="content_type">
				<view class="type_title">
					{{item.type.length > 6 ? item.type.substring(0, 6) + '...':item.type}}
				</view>
				<view class="type_title">
					{{item.desc.length > 6 ? item.desc.substring(0, 6) + '...':item.desc}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {reactive,toRefs} from 'vue';
	export default {
		props:['proList'],
		setup(props){
			const { proList } = toRefs(props);
			const toDetail = (item) =>{
				uni.setStorageSync('activePro',item)
				uni.navigateTo({
					url: '/pages/product/detail'
				});
			}
			return {
				proList,
				toDetail
			}	
		}
	}
</script>

<style lang="scss" scoped>
	.home_item {
		display: flex;
		align-items: center;
		height: 101px;
		opacity: 1;
		border-radius: 10px;
		background: rgba(255, 255, 255, 1);
		border: 2px solid rgba(0, 0, 0, 1);
		margin-bottom: 10px;

		.home_userImg {
			margin: 10px;
		}

		.home_content {
			flex: 1;

			.content_title {
				display: flex;
				font-size: 14px;
				justify-content: space-between;
				padding-right: 15px;

				text {
					font-size: 10px;
					color: rgba(56, 56, 56, 1);
				}
			}

			.content_type {
				display: flex;
				justify-content: flex-start;
				font-size: 12px;
				align-items: center;
				font-weight: 500;
				letter-spacing: 0px;
				line-height: 16.46px;
				color: rgba(0, 0, 0, 1);
				height: 17px;
				margin-top: 10px;

				.type_title {
					height: 24px;
					opacity: 1;
					border-radius: 174px;
					background: rgba(255, 232, 158, 1);
					align-items: center;
					display: flex;
					padding: 0 10px;
					margin-right: 5px;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					max-width: 80px;
				}
			}
		}
	}
</style>